package com.aiks.dsyncpluginspringbootautoconfigure.pojo.mongodb;

import lombok.Data;

import java.util.Date;

/**
 * TODO COMMENT.
 *
 * @author <a href="mailto:taojd@yxt.com">taojd</a>
 * @date 2022-06-30 11:44
 * @since 1.0.0
 **/
@Data
public class MongoDbMsg {

    private long id;

    private String orgId;

    private Object msg;

    private String msgType;

    private String dataCode;

    private Date createTime;

    /**
     * 构建消息存储实体.
     *
     * @param orgId    机构id
     * @param msg      mq消息
     * @param msgType  消息类型
     * @param dataCode 数据版本号
     * @return 消息对象实体
     */
    public static MongoDbMsg builder(final String orgId, final Object msg, final String msgType, final String dataCode) {
        MongoDbMsg mongoDbMsg = new MongoDbMsg();
        mongoDbMsg.setOrgId(orgId);
        mongoDbMsg.setMsg(msg);
        mongoDbMsg.setMsgType(msgType);
        mongoDbMsg.setDataCode(dataCode);
        return mongoDbMsg;
    }

}
